package cn.tedu.zhwy.workspase.controller;

import cn.tedu.zhwy.base.response.JsonResult;
import cn.tedu.zhwy.workspase.pojo.dto.LandlordParam;
import cn.tedu.zhwy.workspase.pojo.vo.LamdlordVO;
import cn.tedu.zhwy.workspase.service.WorkSpaceService;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/v1/workspace")
public class WorkSpaceController {
    @Autowired
    private WorkSpaceService workSpaceService;
    @PostMapping("save")
    public JsonResult save(LandlordParam landlordParam){
        log.debug("landlordParam  C:{}",landlordParam);
        workSpaceService.save(landlordParam);
        return JsonResult.ok();
    }
    @GetMapping("select")
    public JsonResult select(LandlordParam landlordParam){
        log.debug("landlordParam  C:{}",landlordParam);
        List<LamdlordVO> list = workSpaceService.select(landlordParam);
        return JsonResult.ok(list);
    }
    @PostMapping("delete/{lId}")
    public JsonResult delete(@PathVariable("lId") Integer lId){
        log.debug("lid  C:{}",lId);
        workSpaceService.delete(lId);
        return JsonResult.ok();
    }

}
